﻿// *********************************************************************
// [DCOM Productions]
// [Copyright (C) DCOM Productions All rights reserved.]
// *********************************************************************

namespace BitFlex {
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Reflection;
    using System.Text.RegularExpressions;
    using System.Windows.Forms;

    /// <summary>
    /// Enables the deriving class to enable the application to use BitFlex command line pattern with a Windows Form
    /// </summary>
    public class CommandLineFormApplication<TForm> : CommandLineApplication where TForm : System.Windows.Forms.Form, new() {
        /// <summary>
        /// Initializes a new instance of the BitFlex.CommandLineFormApplication class
        /// </summary>
        public CommandLineFormApplication()
            : base() {

            Application.SetCompatibleTextRenderingDefault(true);
            Application.EnableVisualStyles();

            TForm form = new TForm();
            this.Form = form;
        }

        /// <summary>
        /// Gets or sets the form that is run by the framework
        /// </summary>
        public TForm Form {
            get;
            set;
        }

        /// <summary>
        /// Runs the application using the specified form type
        /// </summary>
        public void Run() {
            Application.Run(this.Form);
        }
    }
}